<template>
	<view class="person_real">
		<view class="main">
			<view class="real_info">
				<view class="image">
					<image class="img" :src="id?avatar:userinfo.avatar" mode="aspectFill"></image>
					<image class="icon" src="@/static/images/rz_icon.png" mode=""></image>
				</view>
				<view class="text">
					您所上传的所有信息都将用于核实您的身份，不会向第三方泄漏，请放心上传。认证后将有更多特权。
				</view>
			</view>
			<view class="input">
				<view class="left">认证状态</view>
				<view class="right color">已认证</view>
				<view class="right_icon" v-if="false">
					<text class="txt">去认证</text>
					<u-icon name="arrow-right" color="#bbb" size="28"></u-icon>
				</view>
			</view>
			<view class="input" v-if="id">
				<view class="left">身份角色</view>
				<view class="right" v-if="level==1">个人</view>
				<view class="right" v-if="level==2">管理</view>
				<view class="right" v-if="level==3">副店</view>
				<view class="right" v-if="level==4">店长</view>
			</view>
			<view class="input" v-else>
				<view class="left">身份角色</view>
				<view class="right" v-if="userinfo.level==1">个人</view>
				<view class="right" v-if="userinfo.level==2">管理</view>
				<view class="right" v-if="userinfo.level==3">副店</view>
				<view class="right" v-if="userinfo.level==4">店长</view>
			</view>
			<view class="input">
				<view class="left">真实姓名</view>
				<view class="right">{{name}}</view>
			</view>
			<view class="input">
				<view class="left">身份证号</view>
				<view class="right">{{numberId}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState } from 'vuex';
	export default {
		data() {
			return {
				id:'',
				avatar:'',
				level:'',
				// 
				name:'',
				numberId:'',
			};
		},
		computed:{
			...mapState({
				userinfo: state => state.userinfo
			}),
		},
		onLoad(opt) {
			var that = this
			that.id=opt.id
			if(opt.id){
				that.$tips.showLoading('加载中')
				var params = {
					user_id:opt.id
				}
				that.$httpApi.teamUserInfo(params).then((res)=>{
					that.$tips.hideLoading()
					if(res.code==1){
						that.avatar=res.data.avatar
						that.level=res.data.level
					}
				})
				that.$httpApi.certificationInfo(params).then((res)=>{
					that.$tips.hideLoading()
					if(res.code==1){
						that.name=res.data.name
						that.numberId=res.data.IDNumber
					}
				})
			}else{
				that.$tips.showLoading('加载中')
				that.$httpApi.certificationInfo().then((res)=>{
					that.$tips.hideLoading()
					if(res.code==1){
						that.name=res.data.name
						that.numberId=res.data.IDNumber
					}
				})
			}
		},
	}
</script>

<style lang="less">
	.person_real{
		width: 100%;
		padding-top: 24rpx;
		
		.main{
			width: 100%;
			padding:68rpx 32rpx 20rpx;
			background: #fff;
			.real_info{
				width: 100%;
				.image{
					position: relative;
					width: 120rpx;
					height: 120rpx;
					margin: auto;
					.img{
						position: absolute;
						top: 0;
						left: 0;
						z-index: 1;
						display: block;
						width: 100%;
						height: 100%;
						border-radius: 50%;
					}
					.icon{
						position: absolute;
						bottom: 0;
						right: 0;
						z-index: 2;
						display: block;
						width: 48rpx;
						height: 48rpx;
					}
				}
				.text{
					padding-top: 16rpx;
					padding-bottom: 36rpx;
					font-size: 24rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #888888;
				}
			}
			.input{
				width: 100%;
				height: 100rpx;
				display: flex;
				align-items: center;
				.left{
					width: 200rpx;
					font-size: 28rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #222222;
				}
				.right{
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #888888;
				}
				.color{
					color: #26C281;
				}
				.right_icon{
					width: calc(100% - 200rpx);
					display: flex;
					align-items: center;
					justify-content: space-between;
					.txt{
						font-size: 28rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #888888;
					}
				}
			}
		}
	}
</style>
